﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AlertRole.aspx.cs" Inherits="admin_Dialog_AlertRole" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="/admin/Css/Common.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jQuery1.7.js" type="text/javascript"></script>
    <script src="/Plugin/artDialog/jquery.artDialog.source.js?skin=blue" type="text/javascript"></script>
    <script src="/Plugin/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <link href="/Plugin/flexigrid1.2/css/flexigrid.pack.css" rel="stylesheet" type="text/css" />
    <script src="/Plugin/flexigrid1.2/js/flexigrid.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">

        $(function () {

            $("#RolesList").flexigrid({
                height: 'auto',
                width: 'auto',
                checkbox: true
            });

            var oldRoles = art.dialog.data("oldRoles");
            if (oldRoles) {
                var cache = [];
                $(oldRoles.split(",")).each(function (i, item) {
                    $("#" + item).addClass("trSelected").find("input").attr("checked", true);
                    cache.push({ id: item, name: $("td:eq(1) div", "#" + item).html() });
                });
                art.dialog.removeData("newRoles");  //先清空存储器
                art.dialog.data("newRoles", cache);  //当用户进来后点窗体的 X 时，所属角色不做任何改变
            }
        });

        //确定添加
        var addOk = function () {
            var newRoles = [];
            $('.trSelected', "#RolesList").each(function (i, item) {
                newRoles.push({ id: $(item).attr("id"), name: $.trim($("td:eq(1) div", item).html()) })
            })
            art.dialog.removeData("newRoles");  //先清空存储器
            art.dialog.data("newRoles", newRoles);
            art.dialog.close();  //关闭弹出框
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 426px;">
        <table id="RolesList">
            <thead>
                <tr>
                    <th width="380" style="text-align: center;">
                        角色名称
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="rp_list" runat="server">
                    <ItemTemplate>
                        <tr id="<%#Eval("RoleID") %>">
                            <td>
                                <%#Eval("RoleName")%>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
    </div>
    <div class="aui_buttons">
    <br />
        <button style="float: right;" onclick="addOk()" class="aui_state_highlight" type="button"
            id="Button1">
            确定添加
        </button>
    </div>
    </form>
</body>
</html>
